<template>
    <div>
        {{ count }}&nbsp;<button @click="addCount">count++</button>
    </div>
</template>

<script setup>
import { ref } from 'vue';

let count = ref(0);
const addCount = () => {
    console.log(`++之后：${count.value}`);
    count.value++;
    console.log(`++之后：${count.value}`);
}
</script>

<!-- <script>
import {ref} from 'vue';
export default {
    setup() {
        let count = ref(0);
        const addCount = () => {
            console.log(`++之后：${count.value}`);
            count.value++;
            console.log(`++之后：${count.value}`);
        }
        return { count, addCount }
    }
}
</script> -->